$(function(){
   var zoneId=$.getUrlVar('zoneId');

    $.get("/index.php?m=Admin&c=Zone&a=read&id="+zoneId,function(data){
      var str="";
      console.log(data);
      $(".zone_name").attr("value",data.data.full_parent_name+data.data.name);
      $(".zone_id").attr("value",data.data.id);
    });
    
    $("#form-building-add").Validform({
    tiptype:2,
    ajaxPost:true,
    showAllError:true,
    beforeSubmit:function(curform){
      curform.ajaxSubmit({
        type:'POST',
        url:'/index.php?m=Admin&c=Building&a=add',
        error:function(){
            layr.msg("系统繁忙，请稍候再试");
        },
        success:function(data){
          if(data.stat==1){
             layer.msg("添加成功");
                var index = parent.layer.getFrameIndex(window.name);
                setTimeout(function(){
                       parent.layer.close(index);
                },1000);
                 parent.location.reload();
          }else{
            layer.msg(data.msg);
          }
               
        }
      });
      return false;
    }
  });
});